With advent of the digital times, data storage has evolved from recording data on the conventional paper to recording data on digitalized media, and a database has appeared in order to store a mass of digital data. To effectively manage data stored in the database, an information clerk has to integrate and analyze the data to be stored, a table having logic relationships is therefore generated to facilitate subsequent usage and maintenance of the data.
Taking data of all student basic information in a school for an example, the table might have to record information (e.g. classes, genders, blood types and the like) of hundreds of students, which infers a huge mass of information. Typically, to facilitate efficient subsequent management, the information clerk may execute a series of normalization processing procedures on the table in order to avoid repeated data or contradictory data in the table, so that the table is convenient to use and maintain. However, the normalization processing must be performed by a candidate key of the table. Simply speaking, the candidate key indicates an identification indicator for distinguishing between different data.
For example, Table I, below, is a table recording basic information of students, the table records “Student Nos.” and “Genders” of four students. The “Student No.” and the “Gender” may be referred as an attribute of Table I respectively, and the candidate key is selected from various attribute combinations of the table.
TABLE I1234Student No.A001A002A003A004GenderFemaleFemaleMaleFemale
More specifically, Table I has three attribute combinations, i.e., “Student No.”, “Gender” and “Student No.+Gender”, in addition, the candidate key of Table I selected from the three attribute combinations must satisfy requirements of uniqueness and minimality. Uniqueness implies that the number of aspects exhibited by an attribute combination must be greater than or equal to the data amount of the table. Taking Table I as an example, it records four pieces of data, since each student has a distinct student No., the attribute combination “Student No.” has at least four aspects. The attribute combination “Student No.” is adequate to distinguish among the data pieces recorded in Table I, therefore satisfies the requirement of uniqueness.
Likewise, the attribute combination “Student No.+Gender” exhibits at least four aspects, which means that it also satisfies the requirement of uniqueness. However, the attribute combination “Gender” can only exhibit two aspects (either “Female” or “Male”) which are less than the data amount (4 pieces) recorded in Table I, the attribute combination “Gender” fails to satisfy the requirement of uniqueness and will be eliminated from a list of potential candidate keys. Furthermore, because the attribute combinations “Student No.+Gender” and “Student No.” satisfy the requirement of uniqueness, a determination of minimality will be made next.
Minimality implies that an attribute number of attributes contained in an attribute combination is required to be smaller. As described above, both the attribute combinations “Student No.” and “Student No.+Gender” satisfy the requirement of uniqueness, but the attribute combination “Student No.+Gender” contains two attributes of “Student No.” and “Gender”, while the attribute combination “Student No.” only contains a single attribute of “Student No.”, the attribute combination “Student No.+Gender” will be eliminated since a candidate key must satisfy the requirement of minimality. On the other hand, the attribute combination “Student No.” which satisfies both the requirements of uniqueness and minimality will be set as the candidate key of Table I. In the prior art, unfortunately the candidate key of the table is searched manually by determining the uniqueness and minimality of attribute combinations, which not only makes retrieving the candidate key inefficient, but also lowers the probability of retrieving the correct candidate key due to a lack of experience information clerk.
In view of this, there is a continuing need in the art to make retrieving candidate keys more accurate and efficient.